#include<bits/stdc++.h>
using namespace std;
vector<int>a;
int n,m;
int main(){
    cin>>n>>m;
    for(int i=1;i<=n;++i){
        int x;cin>>x;
        a.push_back(x);
    }
    for (int i=1; i<=m; ++i) {
        int t;cin>>t;
        if(t==1){
            int x,y;cin>>x>>y;
            a.insert(a.begin()+x,y);
        }
        if(t==2){
            int x;cin>>x;
            a.erase(a.begin()+x-1);
        }
    }
    for(unsigned i=0;i<a.size();++i)cout<<a.at(i)<<' ';
    cout<<endl;
    return 0;
}
